<!-- 
	适用APP、H5、小程序的通用弹窗组件
	@Author zhao
	@Date 2021/7/15
	@remark 可作为标签使用
 -->
<template>
	<view v-show="ishide" @touchmove.stop.prevent>
		<!-- 遮罩 -->
		<view class="mask" :style="maskStyle"></view>
		<!-- 内容 -->
		<view class="tip" :style="tipStyle">
			<slot></slot>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			ishide: {
				type: Boolean,
				required: true
			},
			zindex: {
				type: Number,
				default: 99
			},
			opacity: {
				type: Number,
				default: 0.6
			},
			width: {
				type: String,
				default: '500rpx'
			},
			height: {
				type: String,
				default: '500rpx'
			},
			radius: {
				type: String
			},
			bgcolor: {
				type: String,
				default: '#FFFFFF'
			}
		},
		computed: {
			maskStyle() {
				return `
					z-index:${this.zindex};
					background:rgba(0,0,0,${this.opacity});
				`
			},
			tipStyle() {
				return `
					width:${this.width};
					height:${this.height};
					z-index:${this.zindex+1};
					border-radius:${this.radius};
					background-color:${this.bgcolor};
				`
			}
		}
	}
</script>

<style scoped>
	.mask {
		position: fixed;
		bottom: 0;
		right: 0;
		left: 0;
		top: 0;
	}

	.tip {
		position: fixed;
		left: 50%;
		top: 50%;
		transform: translate(-50%, -50%);
		background-color: #FF0000;
	}
</style>
